﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Demo.Tree
{
    public partial class Controls_TreeEvents : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void tree1_NodeClick(object sender, ExtJSExtender.Controls.TreeNodeEventArgs e)
        {
            output("NodeClick被触发，id=" + e.NodeId);
        }

        protected void tree1_NodeSelectChanged(object sender, ExtJSExtender.Controls.TreeNodeSelectChangedEventArgs e)
        {
            output("NodeSelectChanged被触发，id=" + e.NodeId + "；上次选中的节点是" + e.OldSelectedPath);
        }

        protected void tree1_NodeCollapse(object sender, ExtJSExtender.Controls.TreeNodeEventArgs e)
        {
            output("Collapse被触发，id=" + e.NodeId);
        }

        protected void tree1_NodeExpand(object sender, ExtJSExtender.Controls.TreeNodeEventArgs e)
        {
            output("NodeExpand被触发，id=" + e.NodeId);
        }

        private void output(string msg)
        {
            this.lblMessage.Text +=  msg + "<br/><br/>";
        }
    }
}